package com.xx.jicheng.controller.admin;

import java.io.IOException;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.yihang.common.spring.JsonModel;

import com.xx.jicheng.service.ConfigService;

@Controller
public class AdminConfigEngineerController {

	@Autowired
	private ConfigService configService;

	@RequestMapping("/admin/config/engineer/find")
	public void find(HttpServletResponse response) throws IOException {
		response.setCharacterEncoding("utf-8");
		response.setContentType("application/json");
		response.getWriter().print(configService.findByName("engineer.config"));
	}
	
	@RequestMapping("/admin/config/engineer")
	public void engineer(){
		
	}
	
	@RequestMapping("/admin/config/engineer/update")
	@ResponseBody
	public Map<String, Object> update(String json, JsonModel model){
		configService.update("engineer.config", json);
		return model.asMap();
	}
	

}
